package cn.view;

import cn.sc.Tank;

import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class BoomTankAnimation {


    private static ImageIcon _1 = new ImageIcon(Tank.class.getResource("/cn/resource/blast8.gif"));
    private static ImageIcon _2 = new ImageIcon(Tank.class.getResource("/cn/resource/blast7.gif"));
    private static ImageIcon _3 = new ImageIcon(Tank.class.getResource("/cn/resource/blast6.gif"));
    private static ImageIcon _4 = new ImageIcon(Tank.class.getResource("/cn/resource/blast5.gif"));
    private static ImageIcon _5 = new ImageIcon(Tank.class.getResource("/cn/resource/blast4.gif"));
    private static ImageIcon _6 = new ImageIcon(Tank.class.getResource("/cn/resource/blast3.gif"));
    private static ImageIcon _7 = new ImageIcon(Tank.class.getResource("/cn/resource/blast2.gif"));
    private static ImageIcon _8 = new ImageIcon(Tank.class.getResource("/cn/resource/blast1.gif"));

    private static ImageIcon[] animationImageArray = {_1, _2, _3, _4, _5, _6, _7, _8};

    int x;
    int y;
    ImageIcon img;

    public BoomTankAnimation(int x, int y, ImageIcon img) {
        this.x = x;
        this.y = y;
        this.img=img;
    }

    public static Collection buldAnimation(int x, int y) {
        List<BoomTankAnimation> list = new ArrayList<>();
        for (ImageIcon img : animationImageArray) {
            list.add(new BoomTankAnimation(x, y, img));
        }
        return list;
    }
}
